<?php
namespace Common\Service\Sms;

include_once("sms.php");
class ShortMessageService
{
    protected $sms;
    protected $applicationId;
    protected $password;
    protected $extendCode;
    
    function  __construct()
    {
        $this->sms = new Sms('http://61.164.45.183:9080/SMSGateway/services/SMSGatewayService?wsdl');
        //$this->sms = new Sms('http://10.100.67.11:9080/SMSGateway/services/SMSGatewayService?wsdl');
        $this->applicationId="taozhiyuantest";
        $this->extendCode="8";
        $this->password="PY4JL#92eXkU";
    }
    
    public function sendMsgTo($reciverTelephone, $content)
    {
        $destinationAddresses = array($reciverTelephone);
        $params = array('args0'=>$destinationAddresses,
            'args1'=>$content,
            'args2'=>$this->extendCode,
            'args3'=>$this->applicationId,
            'args4'=>$this->password);
    
        try {
            $result = $this->sms->sendMessage($params);
        }
        catch ( SoapFault $e ) { echo $e->getMessage (); }
        catch ( Exception $e ) { echo $e->getMessage (); }

        return $result;
    }
}